package ThreadSleepTest;

/**
 * ClassName ThreadSleep
 * Description TODO
 * Author Hexiao
 * Date 2018/8/24 15:27
 * Version 1.0
 **/
public class ThreadSleep extends Thread {
    public ThreadSleep other;
    int time;
    @Override
    public void run() {
        System.out.println(getName()+"->start");
        try {
          sleep(time);
            System.out.println(getName()+"->run1!");
            other.interrupt();//t2.interrupt();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(getName()+"->run2!");
        }
        System.out.println(getName()+"->end!");
    }
}